package com.feihong.txgw.fragmentadapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.feihong.txgw.ui.fragment.base.BaseFragment;
import com.feihong.txgw.ui.fragment.recharge.GPRSRechargeFragment;
import com.feihong.txgw.ui.fragment.recharge.PhoneRechargeFragment;

import java.util.ArrayList;

/**
 * Created by Sabirjan on 2017/6/13.
 * TXGW.
 * 飞宏电子
 */

public class RechargePagerAdapter extends FragmentPagerAdapter {

    private static  final String []TITLES ={"话费充值","流量充值"};
    private ArrayList<BaseFragment> fragments;
    public RechargePagerAdapter(FragmentManager fm) {
        super(fm);
        fragments =new ArrayList<>();

        PhoneRechargeFragment phoneRechargeFragment=PhoneRechargeFragment.newInstance(PhoneRechargeFragment.class.getName());
        GPRSRechargeFragment gprsRechargeFragment=GPRSRechargeFragment.newInstance(GPRSRechargeFragment.class.getName());

        fragments.add(phoneRechargeFragment);
        fragments.add(gprsRechargeFragment);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return TITLES[position];
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }
}
